package com.quanzhi.openapi.config;

import com.quanzhi.openapi.host.HostAspect;
import com.quanzhi.openapi.host.HostInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
@EnableAspectJAutoProxy
public class MyTestWebMvcConfig  implements WebMvcConfigurer {

    @Bean
    public HostAspect hostAspect()  {
        return new HostAspect();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new HostInterceptor())
                .addPathPatterns("/**");
    }
}
